<template>
  <a-config-provider :locale="locale">
      <router-view v-if="isRouterAlive" :style="changeStyle"/>
  </a-config-provider>
</template>

<script>

import { appMixin } from '@/mixins/mixin'
import { watch, getCurrentInstance, provide, nextTick, ref } from 'vue'
import { useStore } from 'vuex'
import { getLocale } from '@/utils/antDesignLocale'


export default {
  name: 'app',
  mixins: [appMixin],
  setup() {
    const currentVue = getCurrentInstance()
    const store = useStore()

    /**
     * 对vuex中保存国际化的值实行监听
     * 用于修改整个ant-design-vue的国际化
     */
    watch(() => store.getters.getLanguage, (newVal, oldVal) => {
      currentVue.data.locale = getLocale(newVal)
    })

    return {
    }
  }
}
</script>

<style lang="less" src="./assets/css/app.less">
</style>
